package Service;

import java.util.List;

import Entity.Selection;
import Entity.Timetable;
import Dao.TimetableDao;

public class TimetableService {
	
	public boolean addTimetable(Timetable timetable){//添加
		TimetableDao dao=new TimetableDao();
		return dao.addTimetable(timetable);
	}
	public boolean deleteTimetable(Timetable timetable){//删除
		TimetableDao dao=new TimetableDao();
		return dao.deleteTimetable(timetable);
	}
	public boolean deleteTimetable(int id){//删除
		Timetable timetable=new Timetable();
		timetable.setId(id);
		TimetableDao dao=new TimetableDao();
		return dao.deleteTimetable(timetable);
	}
	public boolean updateTimetable(Timetable timetable){//更新
		TimetableDao dao=new TimetableDao();
		return dao.updateTimetable(timetable);
	}
	public List<Timetable> findByTime(int week, int day, int section){//根据时间返回timetable表
		TimetableDao dao=new TimetableDao();
		return dao.findByTime(week, day, section);
	}     
	public List<Timetable> findAllTimetable(){//返回所有timetable表
		TimetableDao dao=new TimetableDao();
		return dao.findAllTimetable();
	}
	//public Timetable findById(int id){}      //根据id返回timetable表
	public static void main(String[] args) {
		TimetableService ser=new TimetableService();
		List<Timetable> lists=ser.findByTime(15, 2, 3);
		for(int i=0;i<lists.size();i++){
			Timetable tmp=lists.get(i);
			System.out.println("房间id:"+tmp.getRoomid());
		}
	}
}
